package com.jumi.microservice.material.listener.excelListener;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.jumi.microservice.material.service.impl.GoodsTaxServiceImpl;
import com.jumi.microservice.material.vo.JmGoodsTaxVo;

/**
 * @description: 税务表上传监听器
 * @author: ZhangY
 */
public class GoodsTaxExcelListener extends AnalysisEventListener<JmGoodsTaxVo>
{

	private Long uid;

	private String name;

	private GoodsTaxServiceImpl goodsTaxService;

	private List<JmGoodsTaxVo> list = new ArrayList<>();


	public GoodsTaxExcelListener(GoodsTaxServiceImpl goodsTaxService, Long uid, String name)
	{
		this.uid = uid;
		this.name = name;
		this.goodsTaxService = goodsTaxService;
	}

	@Override
	public void invoke(JmGoodsTaxVo jmGoodsTaxVo, AnalysisContext analysisContext)
	{
		list.add(jmGoodsTaxVo);
	}

	@Override
	public void doAfterAllAnalysed(AnalysisContext analysisContext)
	{
		goodsTaxService.importGoodsTaxExcel(uid,name,list);
	}
}
